<!DOCTYPE html>
<html>
<head>
    {include file="public/header" /}
    <style>
        .pointer {
            cursor: pointer
        }
    </style>
</head>
<body>
<div class="layui-form layuimini-form layui-form-pane">
    <div class="layui-form-item">
        <input type="hidden" name="id" value="{$info.id}">
        <label class="layui-form-label pointer required" onclick="checkMemberInfo('{$info.buy_code}')">购买人名称</label>
        <div class="layui-input-inline" onclick="checkMemberInfo('{$info.buy_code}')">
            <input type="text" value="{$info.buy_name}" readonly autocomplete="off" class="layui-input pointer">
        </div>
        <label class="layui-form-label pointer required" onclick="checkMemberInfo('{$info.buy_code}')">购买人手机号</label>
        <div class="layui-input-inline" onclick="checkMemberInfo('{$info.buy_code}')">
            <input type="number" value="{$info.buy_phone}" readonly autocomplete="off" class="layui-input pointer">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label pointer required" onclick="checkMemberInfo('{$info.sell_code}')">出售人名称</label>
        <div class="layui-input-inline" onclick="checkMemberInfo('{$info.sell_code}')">
            <input type="text" value="{$info.sell_name}" readonly autocomplete="off" class="layui-input pointer">
        </div>
        <label class="layui-form-label pointer required" onclick="checkMemberInfo('{$info.sell_code}')">出售人手机号</label>
        <div class="layui-input-inline" onclick="checkMemberInfo('{$info.sell_code}')">
            <input type="number" value="{$info.sell_phone}" readonly autocomplete="off" class="layui-input pointer">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">交易状态</label>
        <div class="layui-input-inline">
            <input type="text" value="{$info.trad_status|getTradStatus}" readonly autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">生意名称</label>
        <div class="layui-input-inline">
            <input type="text" value="{$info.industry_title}" readonly autocomplete="off" class="layui-input">
        </div>
        <label class="layui-form-label required">生意类型</label>
        <div class="layui-input-inline">
            <input type="text" value="{$info.levelTitle}" readonly autocomplete="off" class="layui-input">
        </div>
        <label class="layui-form-label required">交易金额</label>
        <div class="layui-input-inline">
            <input type="text" value="{$info.price|priceFormat}" readonly autocomplete="off" class="layui-input">
        </div>
        <label class="layui-form-label required">交易时间</label>
        <div class="layui-input-inline">
            <input type="text" value="{$info.trad_time}" readonly autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">卡券名称</label>
        <div class="layui-input-inline">
            <input type="text" value="{$info.voucher_title}" readonly autocomplete="off" class="layui-input">
        </div>
        <label class="layui-form-label required">卡券金额</label>
        <div class="layui-input-inline">
            <input type="text" value="{$info.voucher_price}" readonly autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">查看截图</label>
        <div class="" style="display: flex">
            {volist name='info.screenshot' id='v'}
            <div class="layui-upload-list" style="margin-top: 5px;">
                <img class="layui-upload-img headImage" style="height: 100px;" src="/upload/{$v}">
            </div>
            {/volist}
        </div>
    </div>
    {if condition="$info.trad_status != 2"}
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-radius" lay-submit lay-filter="saveBtn">违规判定</button>
        </div>
    </div>
    {/if}
</div>
{include file="public/footer" /}
<script>
    layui.use(['form', 'laydate', 'tableSelect', 'layarea', 'upload'], function () {
        var form = layui.form,
            layer = layui.layer,
            $ = layui.$;
        //监听提交
        form.on('submit(saveBtn)', function (data) {
            layer.confirm('确定判定购买方违规吗？<br/>判定违规后，将终止双方交易，并恢复相关状态，购买方将被冻结账号！', function (index) {
                $.ajax({
                    url: '/admin/PlatformData/tradAudit?action=violations',
                    type: 'post',
                    dataType: 'json',
                    data: {id: "{$info.id}"},
                    success: function (res) {
                        if (res.status == true) {
                            // 关闭弹出层
                            layer.msg("违规判定成功");
                            var iframeIndex = parent.layer.getFrameIndex(window.name);
                            parent.layer.close(iframeIndex);
                            window.parent.location.reload();
                        } else {
                            layer.close(index);
                            layer.msg(res.msg);
                        }
                    },
                    error: function () {
                        layer.msg("报错了");
                    }
                });
            });
            return false;
        });

    });

    function checkMemberInfo(code) {
        var index = layer.open({
            title: '用户详情',
            type: 2,
            shade: 0.2,
            maxmin: true,
            shadeClose: true,
            area: ['100%', '100%'],
            content: '/admin/Member/write?code=' + code,
        });
    }
</script>
</body>
</html>